<!DOCTYPE html>
<html>
<head>
	<title> Search Test </title>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
	<meta http-equiv="Access-Control-Allow-Origin" content="*">
	<script src="jquery-1.9.0.js"  type="text/javascript"></script>
	
	
	<style>
	html,body{
		width:100%;
		height:100%;
		margin:0;
		padding:0;
		background-color: #F9F9F9;
	}


.main {
    height: 100%;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;}
.title{
	width: 100%;height: 50px;
}
.inner-left {
  bottom: 0;
  position: absolute;
  top: 50px;
  width: 50%;
  left: 0px;
}
.inner-right {
  bottom: 0;
  position: absolute;
  top: 50px;
  width: 50%;
  right: 0px;
}
.inner-if {
  height: 99%;
  overflow: hidden;
  position: absolute;
  width: 100%;
}
.input-main {
  height: 20px;
  margin-left: 20px;
  width: 480px;
}
.ch{
	float: left; width: 49%; height: 100%;  
}

.turn ,.clear{
  background-color: #3485fb;
  background-repeat: no-repeat;
  border: 0 none;
  color: white;
  cursor: pointer;
  height: 32px;
  padding: 0;
  width: 106px;
}
.viceIframe{
	display: none;
}
	</style>
</head>

<body>
	<div class='main' style=''>
		<div class='title'>
			<input type="text" class="input-main" id="input-main">
			<input class="clear" type='button' value="清空" >
			<input class='turn' type='button' value='谷歌'>
			<input class='baidu' type='button' value='百度&&bing'>
			<input class='baiduFY' type='button' value='百度翻译'>
			<div class='viceIframe'></div>
		</div>
		<div class='inner-left inner-badu'>
			<iframe class='inner-if' src='https://www.baidu.com/'></iframe>
		</div>
		<div class='inner-right inner-bing'>
			<iframe class='inner-if' src='http://cn.bing.com/?scope=web&FORM=QBRE'></iframe>
		</div>
	</div>

<script type="text/javascript">
(function($, exports) {
	/**
	alert("22");
	var c = {};
	var b = [];
var d = //;
var a = ();**/



 
	//基础添加Iframe
	baseAdd = function(className,url){
		var htmIframe = "<iframe class='inner-if' src='"+url+"'></iframe>";
		$("."+className).empty().append(htmIframe);
	};
	
	//基础添加Iframe BaiDu
	baiduAdd = function(txt){
		var url = "https://www.baidu.com/s?wd="+txt+"&rsv_spt=1&rsv_iqid=0xfd5c3231000afd26&issp=1&f=8&rsv_bp=0&rsv_idx=2&ie=utf-8&tn=baiduhome_pg&rsv_enter=0&rsv_sug3=4&rsv_sug1=4&rsv_sug7=101&inputT=1663&rsv_sug4=1938";
		baseAdd("inner-badu",url);
	};
	
	//基础添加Iframe Bing
	bingAdd = function(txt){
		var url = "http://cn.bing.com/search?q="+txt+"&qs=n&form=QBLH&pq="+txt+"&sc=8-4&sp=-1&sk=&cvid=E5990B455EBC413BA7C51D19407FEFEE";
		baseAdd("inner-bing",url);
	};
	
	allAdd = function(txt){
		baiduAdd(txt);
		bingAdd(txt);
	};

$(".baiduFY").click(function(){
	var htmGG = "http://fanyi.baidu.com/translate?aldtype=16047&query=&keyfrom=baidu&smartresult=dict&lang=auto2zh#auto/zh/";
	window.open(htmGG); 
});

$(".baidu").click(function(){
	var  dd = $("#input-main").val();
	allAdd(dd);
});

$("#input-main").keyup(function() {
	var  dd = $("#input-main").val();
	allAdd(dd);
});

$(".turn").click(function(){
	var  dd = $("#input-main").val();
	allAdd(dd);
	var htmGG = "https://www.google.com.hk/webhp?hl=zh-CN&sa=X&ved=0ahUKEwjGt8nLirvNAhUIvY8KHZ64Al4QPAgD#newwindow=1&safe=strict&hl=zh-CN&q="+dd+"";
	window.open(htmGG); 
});

$(".clear").click(function(){
	$("#input-main").val("")
});

})(jQuery, window);
</script>
</body>
</html>
